package com.quasar.hpatient.module.comm_card;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.quasar.hpatient.R;

import lib.quasar.base.frame.BasePresenter;
import lib.quasar.qrcode.ZXingUtil;

/**
 * description: 我的名片
 * created by kalu on 2018/4/8 13:56
 */
public class CardPresenter implements BasePresenter {

    void requestQrcode(Context context, CardView view) {
        if (null == context || null == view) return;
        Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher);
        if (null == bitmap) return;
        Bitmap qrbitmap = ZXingUtil.createQRCodeWithLogo("18791984289", bitmap);
        view.setQrcode(R.id.comm_card_qrcode, qrbitmap);
    }

    void requestName(Context context, CardView view) {
        if (null == context || null == view) return;
        String name = "石桥莎莎";
        view.setText(R.id.comm_card_name, name);
    }

    void requestHead(Context context, CardView view) {
        if (null == context || null == view) return;
        String url = "http://www.qqzhi.com/uploadpic/2014-09-23/000247589.jpg";
        view.setHead(R.id.comm_card_head, url);
    }

    @Override
    public void recycler() {
    }
}
